home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_3 / phoonsrc / inlines_other.h < prev    next >
C/C++ Source or Header  |  1994-02-23  |  6KB  |  243 lines

  1. #include <sys/cdefs.h>
  2. #include <inline/stubs.h>
  3.  
  4. __BEGIN_DECLS
  5.  
  6. #ifndef BASE_EXT_DECL
  7. #define BASE_EXT_DECL extern struct ExecBase * SysBase;
  8. #endif
  9. #ifndef BASE_PAR_DECL
  10. #define BASE_PAR_DECL
  11. #define BASE_PAR_DECL0 void
  12. #endif
  13. #ifndef BASE_NAME
  14. #define BASE_NAME SysBase
  15. #endif
  16.  
  17. static __inline APTR 
  18. AllocMem (BASE_PAR_DECL unsigned long byteSize,unsigned long requirements)
  19. {
  20.   BASE_EXT_DECL
  21.   register APTR  _res  __asm("d0");
  22.   register struct ExecBase *a6 __asm("a6") = BASE_NAME;
  23.   register unsigned long d0 __asm("d0") = byteSize;
  24.   register unsigned long d1 __asm("d1") = requirements;
  25.   __asm __volatile ("jsr a6@(-0xc6)"
  26.   : "=r" (_res)
  27.   : "r" (a6), "r" (d0), "r" (d1)
  28.   : "a0","a1","d0","d1", "memory");
  29.   return _res;
  30. }
  31.  
  32. static __inline APTR 
  33. AllocVec (BASE_PAR_DECL unsigned long byteSize,unsigned long requirements)
  34. {
  35.   BASE_EXT_DECL
  36.   register APTR  _res  __asm("d0");
  37.   register struct ExecBase *a6 __asm("a6") = BASE_NAME;
  38.   register unsigned long d0 __asm("d0") = byteSize;
  39.   register unsigned long d1 __asm("d1") = requirements;
  40.   __asm __volatile ("jsr a6@(-0x2ac)"
  41.   : "=r" (_res)
  42.   : "r" (a6), "r" (d0), "r" (d1)
  43.   : "a0","a1","d0","d1", "memory");
  44.   return _res;
  45. }
  46.  
  47. static __inline void 
  48. CloseLibrary (BASE_PAR_DECL struct Library *library)
  49. {
  50.   BASE_EXT_DECL
  51.   register struct ExecBase *a6 __asm("a6") = BASE_NAME;
  52.   register struct Library *a1 __asm("a1") = library;
  53.   __asm __volatile ("jsr a6@(-0x19e)"
  54.   : /* no output */
  55.   : "r" (a6), "r" (a1)
  56.   : "a0","a1","d0","d1", "memory");
  57. }
  58.  
  59. static __inline void 
  60. FreeMem (BASE_PAR_DECL APTR memoryBlock,unsigned long byteSize)
  61. {
  62.   BASE_EXT_DECL
  63.   register struct ExecBase *a6 __asm("a6") = BASE_NAME;
  64.   register APTR a1 __asm("a1") = memoryBlock;
  65.   register unsigned long d0 __asm("d0") = byteSize;
  66.   __asm __volatile ("jsr a6@(-0xd2)"
  67.   : /* no output */
  68.   : "r" (a6), "r" (a1), "r" (d0)
  69.   : "a0","a1","d0","d1", "memory");
  70. }
  71.  
  72. static __inline struct Library *
  73. OpenLibrary (BASE_PAR_DECL UBYTE *libName,unsigned long version)
  74. {
  75.   BASE_EXT_DECL
  76.   register struct Library * _res  __asm("d0");
  77.   register struct ExecBase *a6 __asm("a6") = BASE_NAME;
  78.   register UBYTE *a1 __asm("a1") = libName;
  79.   register unsigned long d0 __asm("d0") = version;
  80.   __asm __volatile ("jsr a6@(-0x228)"
  81.   : "=r" (_res)
  82.   : "r" (a6), "r" (a1), "r" (d0)
  83.   : "a0","a1","d0","d1", "memory");
  84.   return _res;
  85. }
  86.  
  87. #undef BASE_EXT_DECL
  88. #undef BASE_PAR_DECL
  89. #undef BASE_PAR_DECL0
  90. #undef BASE_NAME
  91.  
  92. #ifndef BASE_EXT_DECL
  93. #define BASE_EXT_DECL extern struct IntuitionBase*  IntuitionBase;
  94. #endif
  95. #ifndef BASE_PAR_DECL
  96. #define BASE_PAR_DECL
  97. #define BASE_PAR_DECL0 void
  98. #endif
  99. #ifndef BASE_NAME
  100. #define BASE_NAME IntuitionBase
  101. #endif
  102.  
  103. static __inline LONG 
  104. GetScreenData (BASE_PAR_DECL APTR buffer,unsigned long size,unsigned long type,struct Screen *screen)
  105. {
  106.   BASE_EXT_DECL
  107.   register LONG  _res  __asm("d0");
  108.   register struct IntuitionBase* a6 __asm("a6") = BASE_NAME;
  109.   register APTR a0 __asm("a0") = buffer;
  110.   register unsigned long d0 __asm("d0") = size;
  111.   register unsigned long d1 __asm("d1") = type;
  112.   register struct Screen *a1 __asm("a1") = screen;
  113.   __asm __volatile ("jsr a6@(-0x1aa)"
  114.   : "=r" (_res)
  115.   : "r" (a6), "r" (a0), "r" (d0), "r" (d1), "r" (a1)
  116.   : "a0","a1","d0","d1", "memory");
  117.   return _res;
  118. }
  119.  
  120. #undef BASE_EXT_DECL
  121. #undef BASE_PAR_DECL
  122. #undef BASE_PAR_DECL0
  123. #undef BASE_NAME
  124.  
  125. #ifndef BASE_EXT_DECL
  126. #define BASE_EXT_DECL extern struct GfxBase*  GfxBase;
  127. #endif
  128. #ifndef BASE_PAR_DECL
  129. #define BASE_PAR_DECL
  130. #define BASE_PAR_DECL0 void
  131. #endif
  132. #ifndef BASE_NAME
  133. #define BASE_NAME GfxBase
  134. #endif
  135.  
  136. static __inline void 
  137. InitBitMap (BASE_PAR_DECL struct BitMap *bitMap,long depth,long width,long height)
  138. {
  139.   BASE_EXT_DECL
  140.   register struct GfxBase* a6 __asm("a6") = BASE_NAME;
  141.   register struct BitMap *a0 __asm("a0") = bitMap;
  142.   register long d0 __asm("d0") = depth;
  143.   register long d1 __asm("d1") = width;
  144.   register long d2 __asm("d2") = height;
  145.   __asm __volatile ("jsr a6@(-0x186)"
  146.   : /* no output */
  147.   : "r" (a6), "r" (a0), "r" (d0), "r" (d1), "r" (d2)
  148.   : "a0","a1","d0","d1","d2", "memory");
  149. }
  150.  
  151. #undef BASE_EXT_DECL
  152. #undef BASE_PAR_DECL
  153. #undef BASE_PAR_DECL0
  154. #undef BASE_NAME
  155.  
  156. #ifndef BASE_EXT_DECL
  157. #define BASE_EXT_DECL extern struct DosLibrary * DOSBase;
  158. #endif
  159. #ifndef BASE_PAR_DECL
  160. #define BASE_PAR_DECL
  161. #define BASE_PAR_DECL0 void
  162. #endif
  163. #ifndef BASE_NAME
  164. #define BASE_NAME DOSBase
  165. #endif
  166.  
  167. static __inline void 
  168. FreeArgs (BASE_PAR_DECL struct RDArgs *args)
  169. {
  170.   BASE_EXT_DECL
  171.   register struct DosLibrary *a6 __asm("a6") = BASE_NAME;
  172.   register struct RDArgs *d1 __asm("d1") = args;
  173.   __asm __volatile ("jsr a6@(-0x35a)"
  174.   : /* no output */
  175.   : "r" (a6), "r" (d1)
  176.   : "a0","a1","d0","d1", "memory");
  177. }
  178.  
  179. static __inline struct RDArgs *
  180. ReadArgs (BASE_PAR_DECL STRPTR arg_template,LONG *array,struct RDArgs *args)
  181. {
  182.   BASE_EXT_DECL
  183.   register struct RDArgs * _res  __asm("d0");
  184.   register struct DosLibrary *a6 __asm("a6") = BASE_NAME;
  185.   register STRPTR d1 __asm("d1") = arg_template;
  186.   register LONG *d2 __asm("d2") = array;
  187.   register struct RDArgs *d3 __asm("d3") = args;
  188.   __asm __volatile ("jsr a6@(-0x31e)"
  189.   : "=r" (_res)
  190.   : "r" (a6), "r" (d1), "r" (d2), "r" (d3)
  191.   : "a0","a1","d0","d1","d2","d3", "memory");
  192.   return _res;
  193. }
  194.  
  195. #undef BASE_EXT_DECL
  196. #undef BASE_PAR_DECL
  197. #undef BASE_PAR_DECL0
  198. #undef BASE_NAME
  199.  
  200. #ifndef BASE_EXT_DECL
  201. #define BASE_EXT_DECL extern struct Library * LocaleBase;
  202. #endif
  203. #ifndef BASE_PAR_DECL
  204. #define BASE_PAR_DECL
  205. #define BASE_PAR_DECL0 void
  206. #endif
  207. #ifndef BASE_NAME
  208. #define BASE_NAME LocaleBase
  209. #endif
  210.  
  211. static __inline void 
  212. CloseLocale (BASE_PAR_DECL struct Locale * locale)
  213. {
  214.   BASE_EXT_DECL
  215.   register struct Library * a6 __asm("a6") = BASE_NAME;
  216.   register struct Locale *a0 __asm("a0") = locale;
  217.   __asm __volatile ("jsr a6@(-0x2a)"
  218.   : /* no output */
  219.   : "r" (a6), "r" (a0)
  220.   : "a0","a1","d0","d1", "memory");
  221. }
  222.  
  223. static __inline struct Locale *
  224. OpenLocale (BASE_PAR_DECL STRPTR name)
  225. {
  226.   BASE_EXT_DECL
  227.   register struct Locale * _res  __asm("d0");
  228.   register struct Library * a6 __asm("a6") = BASE_NAME;
  229.   register STRPTR a0 __asm("a0") = name;
  230.   __asm __volatile ("jsr a6@(-0x9c)"
  231.   : "=r" (_res)
  232.   : "r" (a6), "r" (a0)
  233.   : "a0","a1","d0","d1", "memory");
  234.   return _res;
  235. }
  236.  
  237. #undef BASE_EXT_DECL
  238. #undef BASE_PAR_DECL
  239. #undef BASE_PAR_DECL0
  240. #undef BASE_NAME
  241.  
  242. __END_DECLS
  243.